﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NoORM.Core.DbAcceess;

namespace NoORM.Core.DbDialect
{
    /// <summary>
    /// 数据库方言构建类
    /// </summary>
    public class DbDialectBuilder
    {
        /// <summary>
        /// 构建一个数据库方言
        /// </summary>
        /// <param name="connectionClassName">IDbConnection的实现类的类名</param>
        /// <returns></returns>
        public IDbDialect Builder(string connectionClassName)
        {
            IDbDialect dialect = null;
            switch (connectionClassName)
            {
                case ConnectionBuilder.SqlConnection:
                    dialect = new SqlDialect();
                    break;
                case ConnectionBuilder.MySqlConnection:
                    dialect = new MySqlDialect();
                    break;
                case ConnectionBuilder.OracleConnection:
                    dialect = new OracleDialect();
                    break;
                case ConnectionBuilder.SqliteConnection:
                    dialect = new SqliteDialect();
                    break;
                default:
                    dialect = new SqlDialect();
                    break;
            }
            return dialect;
        }

        
    }
}
